//
//  UINavigationBar+Extention.m
//  TabelibleScrollerViewSample
//
//  Created by chenxinju on 16/6/19.
//  Copyright © 2016年 Innovation. All rights reserved.
//

#import "UINavigationBar+Extention.h"
#import <objc/runtime.h>


const void  *MyViewKey = "MyViewKey";

@implementation UINavigationBar (Extention)

- (void)setOverlay:(UIView *)overlay {
    objc_setAssociatedObject(self, MyViewKey, overlay, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

}
- (UIView *)overlay {
 
return  objc_getAssociatedObject(self, MyViewKey);

}

- (void)fs_setBackgroundColor:(UIColor *)backgroundColor {

    if (!self.overlay) {
        [self setBackgroundImage:[[UIImage alloc]init] forBarMetrics:UIBarMetricsDefault];
        [self setShadowImage:[[UIImage alloc]init]];
        self.overlay = [[UIView alloc]initWithFrame:CGRectMake(0, -20,kScreenW, 64)];
        [self insertSubview:self.overlay atIndex:0];
    }
    
    self.overlay.backgroundColor = backgroundColor;

}
@end
